import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { GuildActivityConfigInfo } from "./info/GuildActivityConfigInfo";
type int = number;
//class GuildActivityConfig
    
    export  class GuildActivityConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._activitys = [];
            if (GuildActivityConfig._instance != null) 
            {
                throw new Error("GuildActivityConfig 单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_guild_activity_config.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new GuildActivityConfigInfo();
                loc1.id = loc2.id;
                loc1.type = loc2.type;
                loc1.name = loc2.name;
                loc1.condition = loc2.condition;
                loc1.time = loc2.time;
                loc1.des = loc2.des;
                loc1.recommend = loc2.recommend;
                loc1.items = loc2.items;
                loc1.url = loc2.url;
                loc1.parse();
                this._map[loc1.id] = loc1;
                this._activitys.push(loc1);
            }
            return;
        }

        public getInfoById(arg1: int): GuildActivityConfigInfo
        {
            return this._map[arg1];
        }

        public GuildActivityConfig.get activitys(): Array<any>
        {
            return this._activitys;
        }

        public static get instance(): GuildActivityConfig
        {
            if (GuildActivityConfig._instance == null) 
            {
                GuildActivityConfig._instance = new GuildActivityConfig();
            }
            return GuildActivityConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_activitys: Array<any>;

        /* internal */ static /* var */_instance: GuildActivityConfig;
    }
